<?php
/**
 * Model
 * @author Sokha RUM
 * */
class Kmodel extends CI_Model {
    function __construct() {
    	parent::__construct();
    	$this->db->query("SET TIMEZONE TO 'GMT'");
        
    }
	/**
	 * getting the next sequence id
	 * @param $seq_name the name of sequence
	 * @author Sokha RUM
	 */
	function get_next_id($seq_name) {
		$sql = "SELECT nextval('".$seq_name."') AS next_id";
		$query = $this->db->query($sql);
        $nb_rows = $query->num_rows();
        if ($nb_rows < 1) {
            return NULL;
        } else {
            $row = $query->row_array();
            return $row["next_id"];
        }
	}
   /**
	 * loading another model
	 * @param $model_name the model name to load
	 * @author Sokha RUM
	 */
	function load_other_model($model_name) {
        $CI =& get_instance();
        $CI->load->model($model_name);
        return $CI->$model_name;
   }
}
?>